#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QString>
#include <QMessageBox>
#include <QTimer>
#include <QSerialPort>
#include <QSerialPortInfo>

#define RELAY_COUNT 4

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pushButton_GetCom_clicked();

    void on_pushButton_OpenCom_clicked();

    void on_pushButton_switch1_released();

    void on_pushButton_switch2_released();

    void on_pushButton_switch3_released();

    void on_pushButton_switch4_released();

private:
    Ui::MainWindow *ui;
    // var
    bool sw[RELAY_COUNT];
    char sendData[RELAY_COUNT];
    QSerialPort serialPort;
    bool comOpenStatus;
    // function
    void syncSwitchDataToCom(char channel, char status);
};
#endif // MAINWINDOW_H
